<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>注册</title>
    <link rel="shortcut icon" href="static/favicon.ico" type="image/x-icon">
    <link rel="stylesheet" type="text/css" href="static/css/reset.css" />
    <link rel="stylesheet" type="text/css" href="static/css/register.css" />
</head>

<body>
    <div class="pos">
        <div class="login">
            <span class="close iconfont icon-close"></span>
            <img src="static/img/login/loginlogo.png" alt="">
            <ul>
                <li></li>
                <li class="phone">使用手机号登陆</li>
                <li></li>
            </ul>
            
                <input style="margin-top: 0;" type="text" name="tel" id="username" placeholder="请输入您的手机号">
                
                <input type="password" name="pass" id="pass" placeholder="请输入密码">
               
                <!-- <input type="password" name="pass2" id="" placeholder="请再次输入密码"> -->
                <!-- <span class="tips">密码或账号不对</span> -->
                <div class="clear"></div>
                <button class="loginbtn" onclick="fn()">注册</button>
           
            
            
        </div>
    </div>
   
</body>
</html>
<script>
    function fn()
    {
    //获取文科输入的值
    let username = document.getElementById("username").value;
    //console.log(username);
    let pass = document.getElementById("pass").value;

    //存储的数据
    let persons = [
    { "username":"xiaoming1","password":"1111" },
    { "username":"xiaoming2","password":"222" },
    { "username":"xiaoming3","password":"33333" },
    ]

    //验证是否注册
    let user = persons.findIndex((item)=>{
       return item.username == username 
    })

    if(user == -1)
    {
      console.log("用户名可以注册")
    }else
    {
      console.log("该用户已注册，请登录")  
    }


    }


</script>